package com.acme;

import com.acme.domain.Bank;
import com.acme.domain.account.*;
import com.acme.domain.account.CheckingAccount;
import com.acme.domain.client.*;
import com.acme.exceptions.ClientExistsException;

public class BankApplication {

	public static void main(String[] args) {

		Client vitoCarleone = new Client("Vito Carleone", Gender.MALE);
		Account vitoAcc = new CheckingAccount(1, 1000000, 50000000);
		vitoCarleone.addAccount(vitoAcc);

		Client michaelCarleone = new Client("Michael Carleone", Gender.MALE);
		Account michaelAcc = new CheckingAccount(2, 50000, 100000);
		michaelCarleone.addAccount(michaelAcc);

		Bank bank = new Bank();

		try {
			bank.addClient(vitoCarleone);
			bank.addClient(michaelCarleone);
		} catch (ClientExistsException e) {
			System.out.println(e.getMessage());
		}
		System.out.println(vitoCarleone);
		System.out.println(michaelCarleone);
		System.out.println(vitoAcc);

		Client vitoCarleone2 = new Client("Vito Carleone", Gender.MALE);
		Account vito2Acc = new CheckingAccount(2, 1000000, 50000000);
		vitoCarleone2.addAccount(vito2Acc);
		System.out.println(vitoCarleone.equals(vitoCarleone2));

		// testing hashcode:
		System.out.println(vitoCarleone.hashCode());
		System.out.println(vitoCarleone2.hashCode());
	}
}